{extend name="Public:base"/}

{block name="main"}

<div class="row">
    <div class="col-md-2">
        <div class="list-group">
            {volist name="list" id="r"}
            <a class="list-group-item {if condition=" $keyid==$r['typeid']"}active{/if}" href="{:U('Type/index','keyid='.$r['typeid'])}">
                {$r['name']}
            </a>
            {/volist}
        </div>
    </div>

    <div class="col-md-10">
        <div class="table-toolbar">
            <a class="btn btn-primary" href="{:U('Type/add')}">新增类型</a>
            <button class="btn btn-primary" onclick="myform.action='{:U('Type/listorder')}';$('#myform').submit();">排序
            </button>
        </div>
        <form id="myform" name="myform" action="{:U('Type/listorder')}" method="post">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th class="w-100px">排序</th>
                    <th width="20">typeid</th>
                    <th align="left">名称</th>
                    <th align="left">简介</th>
                    <th class="w-100px">状态</th>
                    <th class="w-200px center">操作</th>
                </tr>
                </thead>
                <tbody>
                {empty name="list"}
                <tr class="table-data-empty">
                    <td class="text-center empty-info" colspan="8">
                        <i class="fa fa-database"></i> 暂无数据<br>
                    </td>
                </tr>
                {else/}
                {volist name="type_list" id="vo"}
                <tr>
                    <td>{$vo.listorder}</td>
                    <td>{$vo.typeid}</td>
                    <td>{$vo.title_prefix}<a href="{:U('type/index','pid='.$vo['id'])}">{$vo.name}</a></td>
                    <td>{$vo.description}</td>
                    <td>
                        {eq name="vo.status" value="1"}
                        <a href=""><i class="fa fa-check text-success"></i></a>
                        {else/}
                        <a href="javascript:;"><i class="fa fa-ban text-danger"></i></a>
                        {/eq}
                    </td>
                    <td>
                        <a class="btn btn-sm btn-primary" href="{:U('Type/add',array('parentid'=>$vo['typeid'],'keyid'=>$keyid))}">添加子分类</a>
                        <a class="btn btn-sm btn-info" href="{:U('Type/edit',array('typeid'=>$vo['typeid'],'keyid'=>$keyid))}">修改</a>
                        {gt name="vo.parentid" value="0"}
                        <a class="btn btn-sm btn-danger" href="javascript:confirm_delete('{:U('Type/delete',array('typeid'=>$vo['typeid']))}')">删除</a>
                        {/gt}
                    </td>
                </tr>
                {/volist}
                {/empty}
                </tbody>
            </table>
        </form>

    </div>
</div>
{/block}